/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Huu Vinh
 */
@Entity
@Table(name = "PaymentRate", catalog = "Radio_Cabs", schema = "dbo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PaymentRate.findAll", query = "SELECT p FROM PaymentRate p"),
    @NamedQuery(name = "PaymentRate.findByPaymentId", query = "SELECT p FROM PaymentRate p WHERE p.paymentId = :paymentId"),
    @NamedQuery(name = "PaymentRate.findByPaymentName", query = "SELECT p FROM PaymentRate p WHERE p.paymentName = :paymentName"),
    @NamedQuery(name = "PaymentRate.findByPaymentPrice", query = "SELECT p FROM PaymentRate p WHERE p.paymentPrice = :paymentPrice"),
    @NamedQuery(name = "PaymentRate.findByNoDate", query = "SELECT p FROM PaymentRate p WHERE p.noDate = :noDate")})
public class PaymentRate implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue
    @Basic(optional = false)
    @Column(name = "PaymentId", nullable = false)
    private Integer paymentId;
    @Basic(optional = false)
    @Column(name = "PaymentName", nullable = false, length = 30)
    private String paymentName;
    @Basic(optional = false)
    @Column(name = "PaymentPrice", nullable = false)
    private double paymentPrice;
    @Basic(optional = false)
    @Column(name = "NoDate", nullable = false)
    private int noDate;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "paymentRate", fetch = FetchType.EAGER)
    private List<PaymentDetails> paymentDetailsList;

    public PaymentRate() {
    }

    public PaymentRate(Integer paymentId) {
        this.paymentId = paymentId;
    }

    public PaymentRate(Integer paymentId, String paymentName, double paymentPrice, int noDate) {
        this.paymentId = paymentId;
        this.paymentName = paymentName;
        this.paymentPrice = paymentPrice;
        this.noDate = noDate;
    }

    public Integer getPaymentId() {
        return paymentId;
    }

    public void setPaymentId(Integer paymentId) {
        this.paymentId = paymentId;
    }

    public String getPaymentName() {
        return paymentName;
    }

    public void setPaymentName(String paymentName) {
        this.paymentName = paymentName;
    }

    public double getPaymentPrice() {
        return paymentPrice;
    }

    public void setPaymentPrice(double paymentPrice) {
        this.paymentPrice = paymentPrice;
    }

    public int getNoDate() {
        return noDate;
    }

    public void setNoDate(int noDate) {
        this.noDate = noDate;
    }

    @XmlTransient
    public List<PaymentDetails> getPaymentDetailsList() {
        return paymentDetailsList;
    }

    public void setPaymentDetailsList(List<PaymentDetails> paymentDetailsList) {
        this.paymentDetailsList = paymentDetailsList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (paymentId != null ? paymentId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PaymentRate)) {
            return false;
        }
        PaymentRate other = (PaymentRate) object;
        if ((this.paymentId == null && other.paymentId != null) || (this.paymentId != null && !this.paymentId.equals(other.paymentId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entity.PaymentRate[ paymentId=" + paymentId + " ]";
    }
    
}
